﻿function getJsonFrom(formId){ //获取From表单内容 并且转成json格式数组
    var doc = document.getElementById(formId).getElementsByTagName('input');
    var saveLike = '{';
    for(var i=0;i<doc.length;i++){
        var name = doc[i].getAttribute('name');
        if(name!=null) {
            if(i>0){
                saveLike+=',';
            }
            saveLike+="\""+name+"\""+':'+"\""+doc[i].value+"\"";
        }
    }
    var length = doc.length;
    var doc = document.getElementById(formId).getElementsByTagName('textarea');
    for(var i=0;i<doc.length;i++){
        var name = doc[i].getAttribute('name');
        if(name!=null) {
            if(length>0||i>0){
                saveLike+=',';
            }
            saveLike+="\""+name+"\""+':'+"\""+doc[i].value+"\"";
        }
    }
    saveLike+='}';
    saveLike = JSON.parse(saveLike);
    return saveLike;
}

